function [m]=get_g(theta,est_m,b_param_sims,w_param_sims,b_error_sims,w_error_sims,b_Omega,w_Omega,W,nobeta,nosigma)

R=size(b_param_sims,2);
moments=zeros(length(est_m),R);

for r=1:R
   [~,params]=make_ests(theta,[b_param_sims(:,r),w_param_sims(:,r)],[b_error_sims(:,r),w_error_sims(:,r)],b_Omega,w_Omega); 
   moments(:,r)=get_m(params,W,nobeta,nosigma);
end

m=mean(moments,2);
